<script setup lang="ts">
import { getThemeList } from '@/service/ThemeListService'
import { onMounted, ref } from 'vue'

export interface IThemeList {
  jianImg: boolean
  jiangImg: boolean
  title: string
  hot: string
}

const ThemeList = ref<IThemeList[]>([])

const getdata = async () => {
  ThemeList.value = []
  ThemeList.value = await getThemeList()
}

defineExpose({
  getdata,
})

onMounted(getdata)
</script>
<template>
  <div class="theme_list">
    <a
      href="/pin/topic/7210002980895916043"
      class="item"
      target="_blank"
      v-for="item in ThemeList"
      :key="item.title"
    >
      <p class="content">
        <img
          src="../assets/img/jian.png"
          alt=""
          class="tag"
          v-if="item.jianImg"
        />
        <img
          src="../assets/img/jiang.png"
          alt=""
          class="tag"
          v-if="item.jiangImg"
        />
        <!---->
        <span>
          <span class="byte-tooltip__wrapper">
            <span class="content-label">{{ item.title }}</span>
          </span>
        </span>
      </p>
      <p class="hot">{{ item.hot }}</p>
    </a>
  </div>
</template>
<style scoped lang="scss">
.theme_list .content-label,
.theme_list .content {
  font-size: 14px;
  color: #252933;
  word-break: break-all;
}
.theme_list {
  min-height: 7rem;
  padding: 12px 16px;
  .item {
    height: 22px;
    margin: 0;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    width: 100%;

    .content {
      flex-grow: 1;
      margin: 0;
      display: -webkit-box;
      overflow: hidden;
      text-overflow: ellipsis;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 1;
      .tag {
        width: 16px;
        height: 16px;
        vertical-align: middle;
        margin-bottom: 2px;
        border-style: none;
        margin-right: 5px;
      }
    }
    .hot {
      flex-shrink: 0;
      font-size: 12px;
      color: #8a919f;
      padding-left: 30px;
    }
  }
  .item:hover .content {
    color: #007fff;
  }
}
</style>
